import { Controller, Get, Post, Patch, Body, Param, Delete } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { TestCreateDto, TestListDto, TestUpdateDto } from './dto';
import { TestService } from './test.service';

@ApiTags('test')
// @ApiBearerAuth()
@Controller()
export class TestController {
    constructor(private readonly testService: TestService) {}
    /**
     * 新增测试表
     */
    @Post('/test/create')
    create(@Body() createTestDto: TestCreateDto) {
        return this.testService.create(createTestDto);
    }
    /**
     * 测试表列表
     */
    @Post('/test/list')
    list(@Body() dto: TestListDto) {
        debugger
        return this.testService.list(dto);
    }
    // @Get('/test')
    // findAll() {
    //     return this.testService.findAll();
    // }
    /**
     * 测试表详情
     */
    @Get('/test/details/:id')
    @ApiOperation({ summary: '某个测试表信息' })
    @ApiResponse({
        status: 200,
        // description: 'The found record',
        // type: GetTestInfoResult,
    })
    details(@Param('id') id: number) {
        return this.testService.findById(id);
    }
    /**
     * 修改测试表
     */
    @Patch('/test/update/:id')
    @ApiOperation({ summary: '修改测试表信息' })
    update(@Param('id') id: number, @Body() updateTestDto: TestUpdateDto) {
        return this.testService.update(id, updateTestDto);
    }
    /**
     * 删除测试表
     */
    @Delete('/test/remove/:id')
    remove(@Param('id') id: string) {
        return this.testService.delete(+id);
    }
}
